import React from "react"
import HistoryBack from '../HistoryBack'
import './index.scss'
export default class ContentView extends React.Component{
        constructor (props) {
                super (props);
        }
        render () {
                const {children,className,theme} = this.props
                let {title} = this.props
                title = <div className={`header-title ${theme==='supply'&&theme}`}><div className='back'><HistoryBack/></div><div className='header-text'>{title}</div></div>
                let content
                if (children instanceof Array) {
                        title = children.find(item=>item?.props?.slot==='header')
                        content = children.find(item=>item?.props?.slot==='content')
                }else{
                        content = children
                }
                return <div className={`page-content-view ${!!className&&className}`}>
                        <div className="content-header">
                                {title}
                        </div>
                        <div className="content-main">
                                {content}
                        </div>
                </div>
        }

}
